package com.test.demo.controller;

import com.test.demo.model.Repayment;
import com.test.demo.service.RepaymentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
 * 作者：孙志颖
 */
@RestController(value = "/Repayment")
public class RepaymentController {
    @Autowired
    private RepaymentService repaymentService;
    @CrossOrigin
    @RequestMapping(value = "/getOnes")
    public Repayment getOnes(Integer rid) {
        return repaymentService.selectByPrimaryKey(rid);
    }
    @CrossOrigin
    @RequestMapping(value = "getRId")
    public List<Repayment> getRId(){
        System.out.println("调用角色全部类型的接口");
        List<Repayment> listRepayment =repaymentService.getRId();
        return listRepayment;
    }
    @CrossOrigin
    @RequestMapping(value="/getAlls")
    public List<Repayment> getAlls(){
        System.out.println("调用角色全部信息的方法");
       return repaymentService.getAlls();
    }
    @CrossOrigin
    @RequestMapping(value = "/delRepayment",method = RequestMethod.GET)
    public int delRepayment(Integer rid){
        return repaymentService.delRepayment(rid);
    }
    @CrossOrigin
    @RequestMapping(value = "/addRepayment",method = RequestMethod.PUT)
    public int addRole(@RequestBody Repayment repaymentmodel){
        //判断传入参数是否为空
        if (repaymentmodel!=null){

        }else {

        }
        return repaymentService.insertRepayment(repaymentmodel);
    }
    @CrossOrigin
    @RequestMapping(value = "/updateRepayment",method = RequestMethod.PUT)
    public int updateRepayment(@RequestBody Repayment repaymentmodel){
        return repaymentService.updateRepayment(repaymentmodel);
    }

}
